{yun:}include file="$comstyle/header.htm"{/yun}

<div class="w1000">
    <div class="admin_mainbody">
	{yun:}include file="$comstyle/left.htm"{/yun}
   	<div class="com_tit"><span class="com_tit_span">收银台</span></div>
 	<div class=right_box>
    	<div class=admincont_box>
        	<div class="com_body">
            	<iframe id="supportiframe" name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
               	<form name="alipayment" class="layui-form" id="payform" action=" " method="post" onsubmit="return paymentforms();" enctype="multipart/form-data">
               		<div class="payment_boxtable">
                   		<table class="" cellpadding="1" cellspacing="1" border="0">
                    		<tr>
                         		<th>订单编号</th>
                               	<th>购买商品</th>
                               	<th>金额</th>
                           	</tr>
	                     	<tr>
	                        	<td>{yun:}$order.order_id{/yun}<input type="hidden" name="dingdan" value="{yun:}$order.order_id{/yun}" /></td>
	                        	<td>
	                            	{yun:}if $order.type==1{/yun}购买会员 {yun:}elseif $order.type=='2'{/yun}{yun:}$config.integral_pricename{/yun}充值 {yun:}elseif $order.type=='3'{/yun}银行转帐 {yun:}elseif $order.type=='4'{/yun}金额充值 {yun:}elseif $order.type=='5'{/yun}增值服务 {yun:}elseif $order.type=='6'{/yun}课程订购 {yun:}elseif $order.type=='7'{/yun}购买小程序 {yun:}elseif $order.type=='8'{/yun}分享红包推广 {yun:}elseif $order.type=='9'{/yun}悬赏红包 {yun:}elseif $order.type=='10'{/yun}职位置顶 {yun:}elseif $order.type=='11'{/yun}紧急招聘 {yun:}elseif $order.type=='12'{/yun}职位推荐 {yun:}elseif $order.type=='13'{/yun}职位自动刷新 {yun:}elseif $order.type=='16'{/yun}职位刷新 {yun:}elseif $order.type=='17'{/yun}兼职刷新 {yun:}elseif $order.type=='18'{/yun}职位刷新 {yun:}elseif $order.type=='19'{/yun}下载简历 {yun:}elseif $order.type=='20'{/yun}发布职位 {yun:}elseif $order.type=='21'{/yun}发布兼职 {yun:}elseif $order.type=='22'{/yun}发布高级职位 {yun:}elseif $order.type=='23'{/yun}面试邀请 {yun:}elseif $order.type=='24'{/yun}兼职推荐{yun:}elseif $order.type=='26'{/yun}购买广告位 										{yun:}/if{/yun}
                                   	<input type="hidden" name="aliorder" id="aliorder" value="{yun:}$order.order_id{/yun}" />
                                   	<input type="hidden" value="{yun:}$order.id{/yun}" name='oid' id='oid' />
                                   	<input type="hidden" name="alimoney" value="{yun:}$order.order_price{/yun}" />
                                   	<input type="hidden" name="paytype" id="paytype" value="" />
                                   	<input type="hidden" name="subject" value="{yun:}if $order.type==1{/yun}购买会员 {yun:}elseif $order.type=='2'{/yun}{yun:}$config.integral_pricename{/yun}充值 {yun:}elseif $order.type=='3'{/yun}银行转帐 {yun:}elseif $order.type=='4'{/yun}金额充值 {yun:}elseif $order.type=='5'{/yun}增值服务 {yun:}elseif $order.type=='6'{/yun}课程订购 {yun:}elseif $order.type=='7'{/yun}购买小程序 {yun:}elseif $order.type=='8'{/yun}分享红包推广 {yun:}elseif $order.type=='9'{/yun}悬赏红包 {yun:}elseif $order.type=='10'{/yun}职位置顶 {yun:}elseif $order.type=='11'{/yun}紧急招聘 {yun:}elseif $order.type=='12'{/yun}职位推荐 {yun:}elseif $order.type=='13'{/yun}职位自动刷新 {yun:}elseif $order.type=='16'{/yun}职位刷新 {yun:}elseif $order.type=='17'{/yun}兼职刷新 {yun:}elseif $order.type=='18'{/yun}职位刷新 {yun:}elseif $order.type=='19'{/yun}下载简历 {yun:}elseif $order.type=='20'{/yun}发布职位 {yun:}elseif $order.type=='21'{/yun}发布兼职 {yun:}elseif $order.type=='22'{/yun}发布高级职位 {yun:}elseif $order.type=='23'{/yun}面试邀请 {yun:}elseif $order.type=='24'{/yun}兼职推荐 {yun:}/if{/yun}" />
	                         	</td>
	                        	<td>￥{yun:}$order.order_price{/yun}</td>
	                     	</tr>
                     	</table>
  						<div class="payment_boxlist_fk"> 实付款
	                    	<span class="payment_boxlist_fk_n">￥
	    						<span id="order_price">{yun:}$order.order_price{/yun}</span>
	                       	</span>
	                   	</div>
							
						{yun:}if $config.tenpay=='1'||$config.bank=='1'||$config.alipay=='1' || $config.wxpay=='1'{/yun}
						
                           <div class="payment_boxlist_zf" id="pay_style">
                               {yun:}if $config.bank=='1'&&is_array($rows)&&$rows{/yun}<span class="payment_boxlist_zf_s" id="otherpay" onclick="paycheck('otherpay');"><i class="payment_boxlist_zf_icon payment_boxlist_zf_icon_qt"></i>其他支付方式</span>{yun:}/if{/yun}
							{yun:}if $config.tenpay=='1'{/yun}<span class="payment_boxlist_zf_s" id="tenpay" onclick="paycheck('tenpay');"><i class="payment_boxlist_zf_icon payment_boxlist_zf_icon_cft"></i>财付通支付</span>{yun:}/if{/yun}
                               {yun:}if $config.wxpay=='1'{/yun}<span class="payment_boxlist_zf_s" id="wxpay" onclick="paycheck('wxpay');"><i class="payment_boxlist_zf_icon payment_boxlist_zf_icon_wx"></i>微信支付</span>{yun:}/if{/yun}
                               {yun:}if $config.alipay=='1'{/yun}<span class="payment_boxlist_zf_s" id="alipay" onclick="paycheck('alipay');"><i class="payment_boxlist_zf_icon payment_boxlist_zf_icon_zfb"></i>支付宝支付</span>{yun:}/if{/yun}
                           </div>

                           <div class="bank_box other_pay" style="display: none;">
                               <table width="100%" border="0" cellpadding="1" cellspacing="1" class="my_table_msg" style="background:#ddd">
                                   <tr>
                                       <th width="8%" height="30" align="center" bgcolor="#F7FAFF">银行名称</th>
                                       <th width="5%" height="30" align="center" bgcolor="#F7FAFF">开户人</th>
                                       <th width="12%" align="center" bgcolor="#F7FAFF">银行帐户</th>
                                       <th width="14%" align="center" bgcolor="#F7FAFF">开户行</th>
                                   </tr>
                                   {yun:}if is_array($rows){/yun} {yun:}foreach item=blist from=$rows{/yun}
                                   <tr>
                                       <td height="30" align="center" bgcolor="#FFFFFF">{yun:}$blist.bank_name{/yun}</td>
                                       <td height="30" align="center" bgcolor="#FFFFFF">{yun:}$blist.name{/yun}</td>
                                       <td align="center" bgcolor="#FFFFFF">{yun:}$blist.bank_number{/yun}</td>
                                       <td align="center" bgcolor="#FFFFFF">{yun:}$blist.bank_address{/yun}</td>
                                   </tr>
                                   {yun:}/foreach{/yun} {yun:}else{/yun}
                                   <tr>
                                       <td colspan="4" height="26" align="center" bgcolor="#FFFFFF">暂未添加银行</td>
                                   </tr>
                                   {yun:}/if{/yun}
                               </table>

                               <div class="bank_list_p_box">

                                   <div class="bank_list_p">
                                       <span class="bank_list_p_s">汇款银行：</span>
        
										<div class="layui-input-inline">
											<select name="banks" lay-filter="banks">
												<option value="">请选择汇款银行</option>
						 					  	{yun:}foreach from=$rows key=j item=v{/yun}
											  	<option value="{yun:}$v.bank_name{/yun}+{yun:}$v.bank_number{/yun}" >{yun:}$v.bank_name{/yun}</option>
											  	{yun:}/foreach{/yun}
											</select>
											<input type="hidden" name="bank_name" id="bank_name" value="">	
										</div>
									</div>
                                   <div class="bank_list_p">
                                       <span class="bank_list_p_s">汇入账号：</span>
                                       <input type="text" id="bank_number" name="bank_number" class="bank_list_text" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" />
                                   </div>
                                   <div class="bank_list_p">
                                       <span class="bank_list_p_s">汇款金额：</span>
                                       <input type="text" id="bank_price" name="bank_price" class="bank_list_text" value="{yun:}$order.order_price{/yun}" />
                                   </div>
                                   <div class="bank_list_p">
                                       <span class="bank_list_p_s">汇款时间：</span>
                                       <input type="text" id="bank_time" name="bank_time" class="bank_list_text" />
                                   </div>
                                   <div class="bank_list_p">
                                       <span class="bank_list_p_s">备注</span>
                                       <textarea name='order_remark' class="bank_textarea"></textarea>
                                   </div>
                                   <div class="bank_list_p">
                                       <span class="bank_list_p_s">上传汇款单：</span>
                                       <button type="button" class="layui-btn layui-btn-normal noupload" lay-data="{imgid: 'imgicon',parentid: 'imgparent'}">选择文件</button>
                                       <input type="hidden" id="laynoupload" value="1" />   <span id="imgparent" class=" none"> 
                                     <img id="imgicon" src="" width="38" height="38"> 
                                   </span>
                                   </div>
                                
                                   <script type="text/javascript">
                                       layui.use(['laydate'], function() {
                                           var laydate = layui.laydate,
                                               $ = layui.$;
                                           laydate.render({
                                               elem: '#bank_time'
                                           });
                                       });
                                   </script>
                               </div>
                           </div>

                           <div class="payment_boxlist_zf_bth" id="order_pay">
                               <input type="button" value="确认支付" class="payment_boxlist_zf_bth_a" onClick="CheckForm();">
                           </div>
                            
						{yun:}else{/yun}
						<div class="con_banner_no" style="width:300px;"><span></span><em>网站已关闭支付接口，请联系管理员</em></div>
						{yun:}/if{/yun}
 					</div>
              	</form>
            </div>
   		</div>
	</div>
	</div>
</div>

<script src="{yun:}$config.sy_weburl{/yun}/js/layui.upload.js?v={yun:}$config.cachecode{/yun}" type='text/javascript'></script>

<script>
    function paycheck(type) {
        if(type == "wxpay") {
            document.getElementById('payform').action = "";
            $("#payform").attr("target", "supportiframe");
            $("#wxpay").addClass("payment_boxlist_zf_s_cur");
            $("#otherpay").removeClass("payment_boxlist_zf_s_cur");
            $("#tenpay").removeClass("payment_boxlist_zf_s_cur");
            $("#alipay").removeClass("payment_boxlist_zf_s_cur");
            $("#paytype").val("wxpay");
            $(".other_pay").hide();
        } else if(type == "alipay") {
            document.getElementById('payform').action = "../api/alipay/alipayto.php";
            $("#payform").attr("target", "_blank");
            $("#alipay").addClass("payment_boxlist_zf_s_cur");
            $("#otherpay").removeClass("payment_boxlist_zf_s_cur");
            $("#tenpay").removeClass("payment_boxlist_zf_s_cur");
            $("#wxpay").removeClass("payment_boxlist_zf_s_cur");
            $("#paytype").val("alipay");
            $(".other_pay").hide();
        } else if(type == "tenpay") {
            document.getElementById('payform').action = "../api/tenpay/index.php";
            $("#payform").attr("target", "_blank");
            $("#tenpay").addClass("payment_boxlist_zf_s_cur");
            $("#otherpay").removeClass("payment_boxlist_zf_s_cur");
            $("#alipay").removeClass("payment_boxlist_zf_s_cur");
            $("#wxpay").removeClass("payment_boxlist_zf_s_cur");
            $("#paytype").val("tenpay");
            $(".other_pay").hide();
        } else if(type == "otherpay") {
            document.getElementById('payform').action = "index.php?c=payment&act=paybank";
            $("#payform").attr("target", "supportiframe");
            $("#otherpay").addClass("payment_boxlist_zf_s_cur");
            $("#alipay").removeClass("payment_boxlist_zf_s_cur");
            $("#tenpay").removeClass("payment_boxlist_zf_s_cur");
            $("#wxpay").removeClass("payment_boxlist_zf_s_cur");
            $("#paytype").val("bank");
            $(".other_pay").show();
        }
		
    }

    $(function() {
        $("input[name='pay_bank']").eq(0).attr("checked", true); 
       	{yun:}if $company.link_null == '' {/yun}
            $("input[name='linkway']").attr("checked", false);
            $("#linkway_1").attr("checked", true); 
     	{yun:}/if{/yun}
		
		{yun:}if $smarty.get.paytype == 'bank' {/yun}
		paycheck('otherpay');
		{yun:}/if{/yun}
    });
    
	function CheckForm(){
		var oid		=	$("input[name=oid]").val();
		var paytype = 	$("input[name=paytype]").val(); 
		var index	=	loadlayer();
		$.ajax({
			async: false, //设置ajax同步  
			type: 'POST',  
			global:false,
			url: weburl+"/member/index.php?m=ajax&c=order_type",  
			data: {oid:oid,paytype:paytype},  
			success: function(data){
				layer.close(index);
			
 				$('#payform').submit();
			}  
		});
	}
    function paymentforms() {
    	
        var pay_bank = $("#paytype").val();
        
		if(pay_bank == '') {
		
			layer.msg('请选择支付方式！', 2, 8);
			return false;
		} else if(pay_bank == 'bank') {
			if($("#bank_name").val() == "") {
				layer.msg('请填写汇款银行！', 2, 8);
				return false;
			}
			if($("#bank_number").val() == "") {
				layer.msg('请填写汇入账号！', 2, 8);
				return false;
			}
			if($("#bank_price").val() == "") {
				layer.msg('请填写汇款金额！', 2, 8);
				return false;
			}
			if($("#bank_time").val() == "") {
				layer.msg('请填写汇款时间！', 2, 8);
				return false;
			}
		}
		
		if(pay_bank == 'wxpay') {
			var orderId = '{yun:}$order.id{/yun}';
			
			$.post('index.php?c=payment&act=wxurl', {
				orderId: orderId
			}, function(data) {
				$('.wx_payment_ewm').html(data);
				$.layer({
					type: 1,
					title: '微信扫码支付',
					closeBtn: [0, true],
					border: [10, 0.3, '#000', true],
					area: ['320px', '400px'],
					page: {
						dom: "#wxpayTx"
					}
				});
				setInterval("wxorderstatus(" + orderId + ")", 3000);
			})
			return false;
			
		} else if(pay_bank !='bank'){
 
			$.layer({
				type: 1,
				title: '提示',
				closeBtn: [0, true],
				border: [10, 0.3, '#000', true],
				area: ['450px', '280px'],
				page: {
					dom: "#payshow"
				}
			});
		}
    }

    function wxorderstatus(orderid) {
        $.post('{yun:}$config.sy_weburl{/yun}/api/wxpay/wxorder.php', {
            orderid: orderid
        }, function(data) {
            if(data == 1) {
                window.location.href = '';
            }
        });
    }

	layui.use(['form'], function() {
		var form = layui.form,
			layer = layui.layer,
			$ = layui.$;
		
		form.on('select(banks)', function(data){
			if(data.value){
				var bank = data.value.split("+");
				
				$("#bank_name").val(bank[0]);
				$("#bank_number").val(bank[1]);
				form.render('select');
			}
		});
	});
	
</script>

{yun:}include file="$comstyle/footer.htm"{/yun}